package com.cnt.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cnt.entity.Donations;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface DonationsDao extends BaseMapper<Donations> {

    @Update("UPDATE donations SET status = 3 WHERE donation_id = #{donationId}")
    public int deleteDonationById(int donationId);

    @Select("select * from Donations where donation_id = #{id}")
    public Donations getByDonationId(int id);

    @Select("SELECT * FROM Donations ORDER BY deadline ASC LIMIT 10")
    public List<Donations> getIndexTen();
}
